package org.example.FakeAIO_01;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ExecutePool {

    private ExecutorService executorService;

    /**
     * 初始大小，最大大小，阻塞队列大小
     * @param init
     * @param max
     * @param queue
     */
    public ExecutePool(int init,int max,int queue) {
        executorService = new ThreadPoolExecutor(init,max,120, TimeUnit.SECONDS,new ArrayBlockingQueue<>(queue));
    }

    public void execute(Runnable target) {
        executorService.execute(target);
    }
}
